
// 获取本地token的函数
function getToken () {
    let token;
    window.localStorage.getItem('token') ? token = window.localStorage.getItem('token') : token = 'asdsadsasadsadsadsadsadasdasds'
    return token
}
// 存储token
function setTokne (token) {
    window.localStorage.setItem('token', token)
}

// 节流函数 性能优化
const throtTling = function (func, wait) {
    let previous = 0
    return function () {
        const now = Date.now()
        const context = this
        const args = arguments
        if (now - previous > wait) {
            func.apply(context, args)
            previous = now
        }
    }
}
   
// 获取地址栏数据
function getUrlParams() {
    //去除get传参 
    let currentUrl = window.location.href;
    let reg = new RegExp('[a-zA-Z]+\.html');
    let url = reg.exec(currentUrl) ? reg.exec(currentUrl)[0] : 'index.html'; 
    return url + ''
}
// 获取地址栏page数值
function getPages(){
    let currentUrl = window.location.href.split('?')[1].split('=')[1]
    return currentUrl
}